package com.heima;

public class ExecutorTest {

    public static void main(String[] args) {
        //继承Thread类
        myThread myThread1 =new myThread();
        myThread1.setName("Thread1_");
        myThread1.start();

        myThread myThread2=new myThread();
        myThread2.setName("Thread2_");
        myThread2.start();


        //实现 Runnable
        myRunnable myRunnable =new myRunnable();

        Thread thread3 =new Thread(myRunnable);
        thread3.setName("Thread3_");
        thread3.start();

        Thread thread4= new Thread(myRunnable);
        thread4.setName("Thread4_");
        thread4.start();
    }



    /**
     * 创建Runnable
     */

    public static class myRunnable implements Runnable {
        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName()+System.currentTimeMillis());
        }
    }


    /**
     * 创建thread
     */
    public static class myThread extends Thread{
        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName()+System.currentTimeMillis());
        }
    }
}
